package net.da.core.entity;

public enum Operation {

    DF_PERMIT_NONE(1),
    DF_PERMIT_BROWSE(2),
    DF_PERMIT_READ(3),
    DF_PERMIT_NOTE(4),
    DF_PERMIT_RELATE(4),
    DF_PERMIT_VERSION(5),
    DF_PERMIT_WRITE(6),
    DF_PERMIT_DELETE(7);

    private Integer operationCode;

    private Operation(Integer operationCode) {
        this.operationCode = operationCode;
    }

    public int getCode() {
        return operationCode;
    }

    public static Operation getOperationByCode(Integer operationCode) {
        for (Operation operation: values()) {
            if (operation.getCode() == operationCode) {
                return operation;
            }
        }
        return null;
    }

}
